/**
 *@Author: QWP
 *@Description: 自定义按钮
 *@Date 2025-03-11 18:11
 */
interface _ICustomBtn {
  title: string;
  tag?: string;
  className?: string;
  eventKey?: string;
}
export class CustomBtn {
  constructor(private options: _ICustomBtn) {
    this.title = options.title;
    this.tag = options.tag ?? "button";
    this.class = options.className;
  }
  onClick(e) {
    console.log("🚀 ~ CustomBtn ~ onClick ~ e:", e);
  }
  getValue(editor) {
    return "";
  }
  isActive(editor) {
    return false;
  }
  isDisabled(editor) {
    return false;
  }
  exec(editor, value) {
    console.log("🚀 ~ CustomBtn ~ exec ~ this.eventKey:", this.options.eventKey);
    if (this.options.eventKey) {
      editor.emit(this.options.eventKey);
    }
    editor.insertText(value); // value 即 this.getValue(editor) 的返回值
  }
}
